package ctrl

import (
	"net/http"
	"restful/srf"
)

type indexController struct {
	Hello srf.Action
	// curl -X POST -I "http://localhost:3000/test-action"
	TestAction srf.Action `method:"POST"`
}

func testAction(request *http.Request) (statusCode int, response interface{}, responseHeader http.Header) {
	return http.StatusOK, map[string]string{"test": "foo"}, http.Header{"test": {"foo", "bar"}}
}

func hello(request *http.Request) (statusCode int, response interface{}, responseHeader http.Header) {
	return http.StatusOK, map[string]string{"hello": "world"}, nil
}

var Index = indexController{hello, testAction}
